import { request } from "@/utils/service"
import type * as Table from "./types/table"
import { GetEvaluateRequestData } from "./types/table"

/** 增 */
export function createTableDataApi(data: Table.CreateTableRequestData) {
  return request({
    url: "user/addUser",
    method: "post",
    data
  })
}

/** 删 */
export function deleteTableDataApi(data: Table.DeleteTableRequestData) {
  return request({
    url: `user/deleteUser`,
    method: "post",
    data
  })
}

/** 改 */
export function updateTableDataApi(data: Table.UpdateTableRequestData) {
  return request({
    url: "/user/updateUser",
    method: "post",
    data
  })
}

/** 查 */
export function getTableDataApi(params: Table.GetTableRequestData) {
  return request<Table.GetTableResponseData>({
    // url: "table",
    url: "/user/list/page",
    method: "get",
    params
  })
}
export function getEvaluateTableDataApi(params: Table.GetEvaluateRequestData) {
  return request<Table.GetEvaluateTableResponseData>({
    // url: "table",
    url: "/evaluate/list/page",
    method: "get",
    params
  })
}
export function getWorksTableDataApi(params: Table.GetWorksTableData) {
  return request<Table.GetWorksTableResponseData>({
    // url: "table",
    url: "/work/list/page",
    method: "get",
    params
  })
}

export function uploadFiles(file: any) {
  return request<Table.GetTableResponseData>({
    // url: "table",
    url: "/excel/import/account",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data"
    },
    data: file
  })
}
